import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router, { addRouter } from './router'

import ArcoVue from '@arco-design/web-vue'
import '@arco-design/web-vue/dist/arco.css'
// 额外引入图标库
import ArcoVueIcon from '@arco-design/web-vue/es/icon'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { useRoleInfoStore } from '@/stores/roleInfo'
import MonacoEditor from '@/components/MonacoEditor.vue'


const app = createApp(App)

app.use(ArcoVue)
app.use(ArcoVueIcon)
app.component('MonacoEditor', MonacoEditor)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(pinia)

//重新加载之后设置路由
const roleInfoStore = useRoleInfoStore()
if (roleInfoStore.userInfo.id) {
  addRouter(roleInfoStore.userInfo.routers)
}


app.use(router)

app.mount('#app')
